package com.hui.demo.producer;

import com.hui.demo.model.Mood;
import org.springframework.jms.core.JmsMessagingTemplate;
import org.springframework.stereotype.Component;

import javax.annotation.Resource;
import javax.jms.Destination;

/**
 * 生产者
 * @author ziv
 * @date 2018-12-24
 */
@Component
public class MoodProducer {
    @Resource
    private JmsMessagingTemplate jmsMessagingTemplate;

    public void sendMessage(Destination destination, final String message) {
        jmsMessagingTemplate.convertAndSend(destination, message);
    }

    public void sendMessage(Destination destination, final Mood mood) {
        jmsMessagingTemplate.convertAndSend(destination, mood);
    }
}
